package com.advbean.config;

import com.advbean.music.BlackDisc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;

@Configuration
@PropertySource("classpath:/com/resource/app.properties")
public class ExpressiveConfig {
    @Autowired
    private Environment env;

    @Autowired
    public static PropertySourcesPlaceholderConfigurer placeholderConfigurer(){
        return new PropertySourcesPlaceholderConfigurer();
    }

    @Bean
    public BlackDisc disc(){
        return new BlackDisc(env.getProperty("disc.title"),
                env.getProperty("disc.artist"),
                env.getProperty("db.connection.count",Integer.class,30));
    }

}
